#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>

using namespace std;

int main(int argc, char *argv[]) 
{
    try
    {
        if (argc < 5) throw string("bad arguments\n");

        char buf[BUFSIZ];
        for (int i = 1; i <= 4; ++ i) 
        {
            freopen(argv[i], "r", stdin);
            while (fgets(buf, BUFSIZ, stdin) != 0) fputs(buf, stdout);
        }
    }
    catch (const string &err)
    {
        fprintf(stderr, "%s", err.c_str());
    }
    catch (...)
    {
        fprintf(stderr, "uncaught error\n");
    }

    return 0;
}
